package naruto.datastructures.trace;

import naruto.datastructures.instruction.*;
import naruto.datastructures.criteria.*;
import java.util.*;

/**
 *
 * @author nacuong
 */
public abstract class Trace<T extends Instruction> extends Vector<T>{
  public boolean containCriteria(Criteria criteria){
    Criterion criterion;
    for (Instruction insn: this){
      if (insn instanceof MethodInstruction)
        criterion = new MethodCallCriterion(((MethodInstruction)insn).getMethodName());
      else
        criterion = new InstructionCriterion(insn.getClassName(), insn.getMethodInfoName(), insn.getOffset());

      if (criteria.contains(criterion)) return true;
    }

    return false;
  } 
}
